package com.atguigu.gmall.publisher.mapper;


import com.atguigu.gmall.publisher.bean.CourseReviewReduce;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CourseReviewMapper {
    @Select("select\n" +
            "       course_id,\n" +
            "       avg(review_stars) CourseAvgScore,\n" +
            "        sum(uc) userCount,\n" +
            "         sum(rs)/sum(ctime) goodReview \n" +
            "from dws_interaction_review_window\n" +
            "where toYYYYMMDD(stt) = #{date}\n"+
            "group by course_id ;" )
    List<CourseReviewReduce> selectCourseReviewReduce(@Param(value="date")Integer date);
}
